package cn.ito.zjgsu.domain.wrapper;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.JSON;
import cn.ito.zjgsu.domain.ProjectType;

public class ProjectTypeWrapper {
	public static final boolean PROJECTTYPE_DELETE_FLAG = false;
	public static final boolean PROJECTTYPE_EXIST_FLAG = true;
	
	
	private ProjectType projectType;
	
	public ProjectTypeWrapper() {}
	
	public ProjectTypeWrapper(ProjectType projectType) {
		this.projectType = projectType;
	}
	

	public ProjectType getProjectType() {
		return projectType;
	}

	public void setProjectType(ProjectType projectType) {
		this.projectType = projectType;
	}
	
	public String toJsonString(){
		return JSON.toJSONString(this);
	}
	
	public static String toJsonArrayString(List<ProjectTypeWrapper> projectTypeWrappers){
		return JSON.toJSONString(projectTypeWrappers);
	}

	public static ProjectTypeWrapper getTestEntry(){
		ProjectType projectType = new ProjectType();
		projectType.setProjectTypeCreatetime(new Date());
		projectType.setProjectTypeId(1);
		projectType.setProjectTypeName("test");
		projectType.setPtDeleteTags(true);
		ProjectTypeWrapper projectTypeWrapper = new ProjectTypeWrapper();
		projectTypeWrapper.setProjectType(projectType);
		return projectTypeWrapper;
	}
	
	public static void testSelf(){
		System.out.println(getTestEntry().toJsonString());
	}
	
	public static List<ProjectTypeWrapper> wrapList(List<ProjectType> projectTypes){
		List<ProjectTypeWrapper> ptws = new ArrayList<ProjectTypeWrapper>();
		for(ProjectType pt : projectTypes){
			ptws.add(new ProjectTypeWrapper(pt));
		}
		return ptws;
	}
}
